home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ASME's Mechanical Engine…ing Toolkit 1997 December
/
ASME's Mechanical Engineering Toolkit 1997 December.iso
/
cad_elec
/
gerbtool.exe
/
DATA.1
/
DRCVIEW.MAC
< prev
next >
Wrap
Text File
|
1995-01-23
|
5KB
|
234 lines
MACRO startup
# Comment out the following SETGLOBAL if you dont want DRCview to
# remember what line to start on.
SetGlobal $lineNo = 0
END
MACRO DRCview
# This macro provides an improved diplay of DRC errors.
# The report generated by the Tools/DRC command is used to walk thru
# the list of DRC errors.
IF $$VERSION < 5.2
# version check!
Stop "This macro requires at least V5.2!"
END
GetString "Enter DRC report filename:", $drcfile
FileOpen $fd, $drcfile, "r"
IF $$STATUS
IF $lineNo > 0
StrWrite $buf, "Continue at line %n?", $lineNo
MessageBox "DRCVIEW", $buf, 2
IF $$STATUS == $$TRUE
Set $lcnt = 1
REPEAT $lcnt < $lineNo
FileRead $fd, "", $line
IF $$STATUS == 0
STOP "File read error!"
END
Calc $lcnt = $lcnt + 1
END
ELSE
Calc $lineNo = 0
END
END
FileRead $fd, "", $line
REPEAT $$STATUS
Calc $lineNo = $lineNo + 1
# check for a new layer... (need a strncmp)
StrSub $buf, 1, 5, $line
StrCmp $buf, "Layer"
IF $$STATUS == 0
StrRead $line, "Layer %n", $layer
END
StrLoc $line, "[" # were only interested in lines with sequence numbers....
IF $$STATUS > 0
StrLoc $line, ":"
Calc $len = $$STATUS
StrSub $minact, $len + 2, 18, $line # pull out min/act
StrSub $serrtype, 1, $len - 1, $line
StrCmp $serrtype, "Pad/Pad"
# determine error type...
IF $$STATUS == 0
Calc $errtype = 2
ELSE
StrCmp $serrtype, "Pad/Trace"
IF $$STATUS == 0
Calc $errtype = 2
ELSE
StrCmp $serrtype, "Trace/Trace"
IF $$STATUS == 0
Calc $errtype = 2 # errors with involving two items...
ELSE
Calc $errtype = 1 # everything else is a single item error
END
END
END
IF $errtype == 2
StrLoc $line, "["
StrSub $seqnos, $$STATUS, 200, $line
StrRead $seqnos, "[%n,%n", $item1, $item2
# MeasureE2E $layer, $item1, $item2
# Calc $dist = $$STATUS
# GetFirstItem now checks the seqno passed in and, if valid, starts at that item...
GetFirstItem $layer, $item1, $net, $dcode, $type, $x1, $y1, $x2, $y2, $dia, $cw, $flags
GetFirstItem $layer, $item2, $net, $dcode, $type, $x3, $y3, $x4, $y4, $dia, $cw, $flags
CallMacro "CalcBoundingBox", $x1,$y1,$x2,$y2,$x3,$y3,$x4,$y4
ViewWindow $x1,$y1, $x2,$y2
HiliItem $layer, $item1
HiliItem $layer, $item2
# StrWrite $buf, " %s: Distance: %.5n, touch a key to continue...", $serrtype, $dist
StrWrite $buf, " %s: %s, touch a key to continue...", $serrtype, $minact
Pause 0, "DRCVIEW", $buf
ELSE
StrLoc $line, "["
StrSub $seqnos, $$STATUS, 200, $line
StrRead $seqnos, "[%n", $item1
GetFirstItem $layer, $item1, $net, $dcode, $type, $x1, $y1, $x2, $y2, $dia, $cw, $flags
Calc $x3 = $x1 # duplicate the first coord set
Calc $y3 = $y1 # so they are effectively ignored...
Calc $x4 = $x1
Calc $y4 = $y1
CallMacro "CalcBoundingBox", $x1,$y1,$x2,$y2,$x3,$y3,$x4,$y4
ViewWindow $x1,$y1, $x2,$y2
HiliItem $layer, $item1
StrCmp $serrtype, "Missing Drill"
IF $$STATUS == 0
StrWrite $buf, " %s: touch a key to continue...", $serrtype
ELSE
StrWrite $buf, " %s: %s, touch a key to continue...", $serrtype, $minact
END
Pause 0, "DRCVIEW", $buf
END
END
FileRead $fd, "", $line
END
FileClose $fd
END
Calc $lineNo = 0
END
MACRO CalcBoundingBox
# This sub-macro calculates the bounding rectangle of set of four XY coordinates.
# usage: CallMacro "CalcBoundingBox", $x1,$y1,$x2,$y2,$x3,$y3,$x4,$y4
Calc $lx = $1
Calc $ly = $2
IF $3 < $lx
Calc $lx = $3
END
IF $5 < $lx
Calc $lx = $5
END
IF $7 < $lx
Calc $lx = $7
END
IF $4 < $ly
Calc $ly = $4
END
IF $6 < $ly
Calc $ly = $6
END
IF $8 < $ly
Calc $ly = $8
END
Calc $ux = $1
Calc $uy = $2
IF $3 > $ux
Calc $ux = $3
END
IF $5 > $ux
Calc $ux = $5
END
IF $7 > $ux
Calc $ux = $7
END
IF $4 > $uy
Calc $uy = $4
END
IF $6 > $uy
Calc $uy = $6
END
IF $8 > $uy
Calc $uy = $8
END
# return the bounding rect in the first four parameters...
Calc $1 = $lx - .2
Calc $2 = $ly - .2
Calc $3 = $ux + .2
Calc $4 = $uy + .2
END
MACRO drcviewinit
SetGlobal $lineNo = 0
END